package com.flitsneak.designpatterns.behavioralpatterns.visitor;

import com.flitsneak.designpatterns.behavioralpatterns.visitor.concreteelement.FishPondBeauty;
import com.flitsneak.designpatterns.behavioralpatterns.visitor.concreteelement.MaterialBeauty;
import com.flitsneak.designpatterns.behavioralpatterns.visitor.concretevisitor.LickDogFeiFei;
import com.flitsneak.designpatterns.behavioralpatterns.visitor.concretevisitor.LickDogRich;

import java.util.ArrayList;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/7/20 13:55
 * @description 动态伪双分配
 */
public class FeiFei {
    public static void main(String[] args) {

        ArrayList<Beauty> beauties = new ArrayList<>(2);

        FishPondBeauty fishPondBeauty = new FishPondBeauty();
        fishPondBeauty.setAge(19);
        fishPondBeauty.setName("如花");
        beauties.add(fishPondBeauty);

        MaterialBeauty materialBeauty = new MaterialBeauty();
        materialBeauty.setAge(28);
        materialBeauty.setName("金花");
        beauties.add(materialBeauty);

        beauties.forEach(b->b.accept(new LickDogRich()));
        beauties.forEach(f->f.accept(new LickDogFeiFei()));
    }
}
